package com.service.impl;

import com.mapper.UserMapper;
import com.pojo.User;
import com.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public int insertUser(User user) {
        return userMapper.insertUser(user);
    }

    @Override
    public boolean loginUser(User user) {
        boolean flag;
        if (userMapper.loginUser(user)==null){
            flag =false;
        }else {
            flag =true;
        }
        return flag;
    }

    @Override
    public User searchUser(User user) {
        return userMapper.searchUser(user);
    }

    @Override
    public int insertAvatar(User user) {
        int i = userMapper.insertAvatar(user);
        return i;
    }

    @Override
    public int updateNickname(User user) {
        return userMapper.updateNickname(user);
    }

    @Override
    public int updatePwd(User user) {
        return userMapper.updatePwd(user);
    }

}
